home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Mathematics / Notebooks / SigProc2.0 / Packages / SignalProcessing / Support / ROC.m < prev    next >
Encoding:
Text File  |  1992-08-18  |  6.2 KB  |  213 lines

  1. (*  :Title:    Region of Convergence  *)
  2.  
  3. (*  :Authors:    Brian Evans, James McClellan  *)
  4.  
  5. (*  :Summary:    To provide region of convergence routines for transforms  *)
  6.  
  7. (*  :Context:    SignalProcessing`Support`ROC`  *)
  8.  
  9. (*  :PackageVersion:  2.7    *)
  10.  
  11. (*
  12.     :Copyright:    Copyright 1989-1991 by Brian L. Evans
  13.         Georgia Tech Research Corporation
  14.  
  15.     Permission to use, copy, modify, and distribute this software
  16.     and its documentation for any purpose and without fee is
  17.     hereby granted, provided that the above copyright notice
  18.     appear in all copies and that both that copyright notice and
  19.     this permission notice appear in supporting documentation,
  20.     and that the name of the Georgia Tech Research Corporation,
  21.     Georgia Tech, or Georgia Institute of Technology not be used
  22.     in advertising or publicity pertaining to distribution of the
  23.     software without specific, written prior permission.  Georgia
  24.     Tech makes no representations about the suitability of this
  25.     software for any purpose.  It is provided "as is" without
  26.     express or implied warranty.
  27.  *)
  28.  
  29. (*  :History:    *)
  30.  
  31. (*  :Keywords:    region of convergence, open set    *)
  32.  
  33. (*  :Source:    *)
  34.  
  35. (*  :Warning:    *)
  36.  
  37. (*  :Mathematica Version:  1.2 or 2.0 *)
  38.  
  39. (*  :Limitation:  *)
  40.  
  41. (*  :Discussion:  *)
  42.  
  43. (*  :Functions:      FindRMinus
  44.           FindRPlus
  45.           GetRMinus
  46.           GetRPlus
  47.           InfCheck
  48.           IntersectsROC
  49.           WithinROC
  50.  *)
  51.  
  52.  
  53. If [ TrueQ[ $VersionNumber >= 2.0 ],
  54.      Off[ General::spell ];
  55.      Off[ General::spell1 ] ]
  56.  
  57.  
  58. (*  B E G I N     P A C K A G E  *)
  59.  
  60. BeginPackage[ "SignalProcessing`Support`ROC`",
  61.           "SignalProcessing`Support`SupCode`" ]
  62.  
  63.  
  64. (*  U S A G E     I N F O R M A T I O N  *)
  65.  
  66. FindRMinus::usage =
  67.     "FindRMinus[rminus1, rminus2] and FindRMinus[rminus1, rminus2, \
  68.     lowerlimit] returns the greater of the two coordinates rminus1 \
  69.     and rminus2. \
  70.     This function and FindRPlus[] are used to find \
  71.     the intersection of two regions of convergence."
  72.  
  73. FindRPlus::usage =
  74.     "FindRPlus[rplus1, rplus2] and FindRPlus[rplus1, rplus2, lowerlimit] \
  75.     returns the lesser of the two coordinates rplus1 and rplus2. \
  76.     This function and FindRMinus[] are used to find the intersection of \
  77.     two regions of convergence."
  78.  
  79. GetRMinus::usage =
  80.     "GetRMinus returns the value of the Rminus component of the \
  81.     region of convergence contained in the passed argument. \
  82.     So, GetRMinus[ZTransData[x,rm,rp,z]] returns the value of rm; \
  83.     GetRMinus[Rminus[x]] returns x; and GetRMinus[x] returns x."
  84.  
  85. GetRPlus::usage =
  86.     "GetRPlus returns the value of the Rplus component of the \
  87.     region of convergence contained in the passed argument. \
  88.     GetRPlus[ZTransData[x,rm,rp,z]] returns the value of rp; \
  89.     GetRPlus[Rplus[x]] returns x; and GetRPlus[x] returns x."
  90.  
  91. InfCheck::usage =
  92.     "InfCheck[expr] returns Infinity if expr is any Infinity form; \
  93.     otherwise, expr is returned."
  94.  
  95. IntersectsROC::usage =
  96.     "Intersects[rm1,rp1,rm2,rp2] returns True if the interval (rm1,rp1) \
  97.     overlaps with the interval (rm2,rp2) in any way. \
  98.     Therefore, IntersectsROC will return False when the two intervals \
  99.     only overlap at endpoints."
  100.  
  101. LTransData::usage =
  102.     "LTransData is a data tag for a valid Laplace transform object."
  103.  
  104. LVariables::usage =
  105.     "LVariables is a data tag for variables in a Laplace transform object."
  106.  
  107. Rminus::usage =
  108.     "Rminus[ <r-minus> ] is the head for the R- value in a transform."
  109.  
  110. Rplus::usage =
  111.     "Rplus[ <r-plus> ] is the head for the R+ value in a transform."
  112.  
  113. Transform::usage =
  114.     "Transform[transform, rminus, rplus] represents a transform. \
  115.     Transform is also a tag for exporting errors messages like \
  116.     Transform::twosided. \
  117.     This object is used exclusively by the \
  118.     various transform rule bases."
  119.  
  120. WithinROC::usage =
  121.     "WithinROC[rm1,rp1,rm2,rp2] returns True if the interval [rm1,rp1] \
  122.     is a subset of the interval [rm2,rp2]."
  123.  
  124. ZTransData::usage =
  125.     "ZTransData is a data tag for a valid z-transform object."
  126.  
  127. ZVariables::usage =
  128.     "ZVariables is a data tag for the variables in a z-transform object. \
  129.         When applied to an object x containing z-transform information, \
  130.     ZVariables[x] returns the z-variables contained in the z-transform. \
  131.     For example, if x is a z-transform object of the form \
  132.     ZTransData[ zexpr, Rminus[r-], Rplus[r+], ZVariables[z] ], then \
  133.     ZVariables would return z."
  134.  
  135. (*  E N D     U S A G E     I N F O R M A T I O N  *)
  136.  
  137.  
  138. Begin["`Private`"]
  139.  
  140.  
  141. (*  R E G I O N     O F     C O N V E R G E N C E  *)
  142.  
  143. (*  FindRMinus  *)
  144. FindRMinus[rminus1_, rminus2_, lowlimit_:0] :=
  145.     Which [ SameQ[rminus1, Infinity], Infinity,
  146.         SameQ[rminus2, Infinity], Infinity,
  147.         SameQ[rminus1, lowlimit], rminus2,
  148.         SameQ[rminus2, lowlimit], rminus1,
  149.         True, Max[rminus1, rminus2] ]
  150.  
  151. (*  FindRPlus  *)
  152. FindRPlus[rminus1_, rminus2_, lowlimit_:0] :=
  153.     Which [ SameQ[rminus1, Infinity], rminus2,
  154.         SameQ[rminus2, Infinity], rminus1,
  155.         SameQ[rminus1, lowlimit], lowlimit,
  156.         SameQ[rminus2, lowlimit], lowlimit,
  157.         True, Min[rminus1, rminus2] ]
  158.  
  159. (*  GetRMinus  *)
  160. GetRMinus[Transform[x_, rm_, rp_]] := rm
  161. GetRMinus[ZTransData[x_, rm_, rp_, z_]] := GetRMinus[rm]
  162. GetRMinus[LTransData[x_, rm_, rp_, z_]] := GetRMinus[rm]
  163. GetRMinus[Rminus[x__]] := x
  164.  
  165. (*  GetRPlus  *)
  166. GetRPlus[Transform[x_, rm_, rp_]] := InfCheck[rp]
  167. GetRPlus[ZTransData[x_, rm_, rp_, z_]] := GetRPlus[rp]
  168. GetRPlus[LTransData[x_, rm_, rp_, z_]] := GetRPlus[rp]
  169. GetRPlus[Rplus[x_]] := InfCheck[x]
  170.  
  171. (*  InfCheck  *)
  172. SetAttributes[InfCheck, Listable]
  173. InfCheck[x_] := If [ InfinityQ[x], Infinity, x ]
  174.  
  175. (*  IntersectsROC  *)
  176. IntersectsROC[rm1_, rp1_, rm2_, rp2_] :=
  177.     (InRange[rm2,rm1,rp2,0,Infinity] || InRange[rm2,rp1,rp2,0,Infinity]) &&
  178.     (! SameQ[rp1, rm2] && ! SameQ[rp2, rm1] )
  179.  
  180. (*  WithinROC  *)
  181. WithinROC[rm1_, rp1_, rm2_, rp2_] := N[ ( rm1 >= rm2 ) && ( rp1 <= rp2 ) ]
  182.  
  183. (*  ZVariables  *)
  184. ZTransData/: ZVariables[ZTransData[f_, rm_, rp_, z_]] := ZVariables[z]
  185. ZVariables[ZVariables[z_]] := z
  186.  
  187.  
  188. (*  E N D     P A C K A G E  *)
  189.  
  190. End[]
  191. EndPackage[]
  192.  
  193. If [ TrueQ[ $VersionNumber >= 2.0 ],
  194.      On[ General::spell ];
  195.      On[ General::spell1 ] ]
  196.  
  197.  
  198. (*  H E L P     I N F O R M A T I O N  *)
  199.  
  200. Block [    {newfuns},
  201.     newfuns =  { FindRMinus, FindRPlus,    GetRMinus, GetRPlus,
  202.              InfCheck,   IntersectsROC, WithinROC };
  203.     Combine[ SPfunctions, newfuns ];
  204.     Apply[ Protect, newfuns ] ]
  205.  
  206. Protect[Rminus, Rplus]
  207.  
  208.  
  209. (*  E N D I N G     M E S S A G E  *)
  210.  
  211. Print["Region of convergence routines for the transform rule bases are loaded."]
  212. Null
  213.